package cn.v2tila.rsosa.student.service.serviceImpl;

import cn.v2tila.rsosa.student.entity.AssoEntity;
import cn.v2tila.rsosa.student.jpa.AssoJPA;
import cn.v2tila.rsosa.student.service.AssoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Optional;

/**
 * @author v2tila on 20:24 2019/2/27
 */
@Service
public class AssoServiceImpl implements AssoService {
    @Autowired
    private AssoJPA assoJPA;

    public List<AssoEntity> findBySchoolNoAndAndCollegeNo(String schoolNo, String collegeNo) {
        return assoJPA.findBySchoolNoAndAndCollegeNo(schoolNo, collegeNo);
    }

    public AssoEntity findBySchoolNoAndName(String schoolName, String name) {
        return assoJPA.findBySchoolNoAndName(schoolName,name);
    }

    public AssoEntity saveAndFlush(AssoEntity assoEntity) {
        return assoJPA.saveAndFlush(assoEntity);
    }

    public AssoEntity findByUniqueId(String uniqueId) {
        return assoJPA.findByUniqueId(uniqueId);
    }

    public AssoEntity findById(Integer id) {
        Optional<AssoEntity> findResult = assoJPA.findById(id);
        return findResult.get();
    }

    @Override
    public AssoEntity findBySchoolNoAndUniqueId(String schoolNo, String uniqueId) {
        return assoJPA.findBySchoolNoAndUniqueId(schoolNo, uniqueId);
    }


}
